﻿@using Dignite.Abp.NotificationCenter.Blazor.Pages.NotificationCenter
@using Volo.Abp.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Web
@inherits AbpComponentBase
@if(CurrentUser.IsAuthenticated)
{
    <Dropdown Display="Display.InlineBlock" RightAligned Margin="Margin.Is2.FromStart.Is2.FromEnd" VisibleChanged="OnVisibleChanged">
        <DropdownToggle Color="Color.Light">
            <BarIcon IconName="IconName.Bell"></BarIcon>
            @if (notificationCount > 0)
            {
                <Badge Color="Color.Danger" Pill Position="Position.Absolute.Top.Is0.Start.Is100.Translate.Middle">
                    @notificationCount
                </Badge>
            }
        </DropdownToggle>
        <DropdownMenu Shadow="Shadow.Large">
            <Div Flex="Flex.JustifyContent.Between.AlignItems.Center" Padding="Padding.Is3.OnX.Is2.OnY" Style="min-width:300px;">
                @L["NotificationCenter"]
                <Icon Name="IconName.Bell" IconStyle="IconStyle.Regular" Clicked="OpenSubscribeModalAsync" title="@L["Subscribe"]"></Icon>
            </Div>
            <DropdownDivider></DropdownDivider>
            <Div Overflow="Overflow.Auto" Position="Position.Relative" Style="max-height:70vh;">
                <NotificationsComponent @ref="NotificationsComponentRef" OnSetNotificationRead="SetNotificationRead"></NotificationsComponent>
            </Div>
        </DropdownMenu>
    </Dropdown>
    <SubscribeModal @ref="SubscribeModalRef"></SubscribeModal>
}